Pass the root directory to Doxyfilter and thence pythfilter.py so that the latter...
authorewan@linford.intra <ewan@linford.intra>
Tue, 13 Sep 2005 13:42:21 +0000 (14:42 +0100)
committerewan@linford.intra <ewan@linford.intra>
Tue, 13 Sep 2005 13:42:21 +0000 (14:42 +0100)
docs/Doxyfile
docs/pythfilter.py

index 8048a380777b735dee6fcb61729d39970335d67a..21b06aa07fcc75de8b05483ed4ed6ff28d2af2ca 100644 (file)
@@ -519,7 +519,7 @@ IMAGE_PATH             =
 # to standard output.  If FILTER_PATTERNS is specified, this tag will be 
 # ignored.
 
-INPUT_FILTER           = "sh ./Doxyfilter"
+INPUT_FILTER           = "sh ./Doxyfilter ../tools/python"
 
 # The FILTER_PATTERNS tag can be used to specify filters on a per file pattern 
 # basis.  Doxygen will compare the file name with each pattern and apply the 
index 81a13d99735cb65c13f7b74ab072e9ec7d0b8f29..3054f7caf3a929dc6004e354dae77c046d86aba9 100644 (file)
@@ -469,12 +469,25 @@ def dump(filename):
         sys.stdout.write(s)\r
 \r
 def filter(filename):\r
-    global name, module_has_docstring\r
+    global name, module_has_docstring, source_root\r
 \r
     path,name = os.path.split(filename)\r
     root,ext  = os.path.splitext(name)\r
 \r
-    output("namespace "+root+" {\n",(0,0))\r
+    if source_root and path.find(source_root) == 0:\r
+        path = path[len(source_root):]\r
+\r
+        if path[0] == os.sep:\r
+            path = path[1:]\r
+\r
+        ns = path.split(os.sep)\r
+    else:\r
+        ns = []\r
+\r
+    ns.append(root)\r
+\r
+    for n in ns:\r
+        output("namespace " + n + " {\n",(0,0))\r
 \r
     # set module name for tok_eater to use if there's a module doc string\r
     name = root\r
@@ -486,7 +499,9 @@ def filter(filename):
     print_comment((0,0))\r
 \r
     output("\n",(0,0))\r
-    output("}  // end of namespace\n",(0,0))\r
+    \r
+    for n in ns:\r
+        output("}  // end of namespace\n",(0,0))\r
 \r
     if not module_has_docstring:\r
         # Put in default namespace documentation\r
@@ -611,9 +626,10 @@ def convert(srcpath, destpath):
 ######################################################################\r
 \r
 filter_file = False\r
+source_root = None\r
 \r
 try:\r
-    opts, args = getopt.getopt(sys.argv[1:], "hf", ["help"])\r
+    opts, args = getopt.getopt(sys.argv[1:], "hfr:", ["help"])\r
 except getopt.GetoptError,e:\r
     print e\r
     sys.exit(1)\r
@@ -622,10 +638,13 @@ for o,a in opts:
     if o=="-f":\r
         filter_file = True\r
 \r
+    if o=="-r":\r
+        source_root = os.path.abspath(a)\r
+\r
 if filter_file:\r
     # Filter the specified file and print the result to stdout\r
     filename = string.join(args)\r
-    filterFile(filename)\r
+    filterFile(os.path.abspath(filename))\r
 else:\r
 \r
     if len(args)!=2:\r